import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import FirstPage from '@/components/firstPage'
import secondPage from '@/components/secondPage'
import advantagePage from '@/components/indexPage/advantage'
import team from '@/components/team/team'
import security from '@/components/security/security'
import culture from '@/components/culture/culture'
import about from '@/components/culture/about'
import connect from '@/components/culture/connect'
import bookOnline from '@/components/bookOnline/bookOnline'
import base from '@/components/base/base'
import singleTeacher from '@/components/team/singleTeacher'
import companyPic from '@/components/utils/companyPic'
import video from '@/components/utils/video'

Vue.use(Router)

export default new Router({
    routes: [{
        path: '/',
        name: 'HelloWorld',
        component: HelloWorld,
        redirect:"/advantagePage",
        children: [{
                path: '/firstPage',
                name: FirstPage,
                component: FirstPage
            }, {
                path: '/sacondPage',
                name: secondPage,
                component: secondPage
            },
            {
                path: '/advantagePage',
                name: advantagePage,
                component: advantagePage,
                children:[
                  {   //当首次进入页面时，页面没有显示任何组件；让页面一加载进来就默认显示first页面
                    path:'/advantagePage', //重定向，就是给它重新指定一个方向，加载一个组件；
                    component:resolve => require(['@/components/utils/companyPic'],resolve)
                  },
                  {
                    path:'/advantagePage/showPic',
                    name:'showPic',
                    component:companyPic
                  } ,{
                    path:'/advantagePage/showVideo',
                    name:'showVideo',
                    component:video
                  }
                ]
            },
            {
                path: '/teamPage',
                name: team,
                component: team
            },
            {
              path: '/security',
              name: security,
              component: security
            },
            {
              path:'/culture',
              name:culture,
              component:culture
            },
            {
              path:'/about',
              name:about,
              component:about
            },
            {
              path:'/connect',
              name:connect,
              component:connect
            },
            {
              path:'/bookOnline',
              name:bookOnline,
              component:bookOnline
            },
            {
              path:'/aboutBase',
              name:base,
              component:base
            },
            {
              path:'/singleTeacher',
              name:'singleTeacher',
              component:singleTeacher
            }
        ]
    }]
})
